package com.zwd.deep.controller;


import cn.hutool.db.PageResult;
import com.zwd.deep.common.RequestResult;
import com.zwd.deep.entity.dto.HistoryPageDTO;
import com.zwd.deep.entity.vo.HistoryRecordVo;
import com.zwd.deep.service.IHistoryRecordsService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 历史记录表
 *
 * @author zwd
 * @since 2025-02-12
 */
@RestController
@RequestMapping("/history-records")
@AllArgsConstructor
@Slf4j
@Validated
public class HistoryRecordsController {

    private final IHistoryRecordsService historyService;

    /**
     * 分页查询历史记录
     * @param historyPageDTO 分页参数
     * @return 分页历史记录
     */
    @PostMapping("/history/records")
    public RequestResult<List<HistoryRecordVo>> getHistoryRecords(@RequestBody HistoryPageDTO historyPageDTO) {
        List<HistoryRecordVo> pageResult = historyService.getHistoryRecords(historyPageDTO);
        return RequestResult.success(pageResult);
    }

}
